#
  • (+91) 943 407 1193
  • nihar.mohanty@stpi.in

Week-13 Assignments

OutPut Devices
   

In this assignment, I am going to interface a 5V Relay module with Arduino Uno to control high power devices. As we already know, Arduino Uno work on 5V and the maximum current a digital pin can drive is less than 40mA. In this assignment I am using a 5V  channel relay module for driving higher power devices like home appliances DIRECTLY with Arduino  depending on the use case we can go with 2 channel relay, 4 channel relay, 8 channel relay…...

 

 


 

Relay Module

A relay is generally an electrically operated switch. The principle used by the relays is an electromagnet to mechanically operate the switch. So basically it operates a switch using an electromagnet which needs only less power like 5V, 12V or 24V. Different kinds of relays are available in the market like SPDT, DPDT, SPST, 5V, 12V, 24V and with various high current/voltage driving capacity.

 
   

Relay has two groups of Pins: Low voltage group and High voltage group.

- Pins in the Low voltage group are connected to Arduino, including three pins:
- GND pin : needs to be connected to to GND (0V)
- VCC pin : needs to be connected to VCC (5V)
- IN pin : receives the control signal from Arduino

- Pins in the high voltage group are connected to the high voltage device, including three pins (usually in screw terminal):
- COM pin : is the common pin. It is used in both normally open mode and normally closed mode
- NO pin : is normally open pin. It is used in the normally open mode
- NC pin : is normally closed pin. It is used in the normally closed mode
Here I have used two pins only, as usually don’t  use all the pins in the high voltage group.

    • Use only COM pin and NO pin if we use normally open mode.

    • Use only COM pin and NC pin if we use normally closed mode.

 
 

Things to note when working with your Relay

* The relay is not an ideal switch...meaning don't use your relay for basic switching purpose like turning on/off LED...it will wear off the mechanical parts faster...this example was just for demonstration
* They are not good for fast switch application
* Relays are more suitable for high voltage application or relatively slow switching like controlling servos.

 
 
     

Controlling DC Devices with Relay                                         

  • Arduino Uno 
  • 5V Relay             
  • LED                                                                                  
  • BreadBoard                                                                   
Jumper Wire
 
     

NO, NC and COM Terminals

Usually SPDT (Singe Pole Double Throw) relays have 3 output terminals, these are the 3 terminals of internal SPDT electromagnetic switch.

Common (COM)

This is the commonly terminal. This terminal will be connected to either of other 2 terminals (NO or NC) based on the state of relay.

Normally Open (NO)

As the name indicates this is normally open terminal, ie. if the relay is not energized (not ON), this pin will be open. We can say that the switch is OFF by default and when the relay is energized it will become ON.

Normally Closed (NC)

As the name indicates it is normally closed terminal, ie. if the relay is not energized (not ON), this pin will be closed. We can say that the switch is ON by default and when the relay is energized it will become OFF.

 
   

Interfacing Relay with Arduino Uno

In the first phase I am going to control a normal LED for testing the functionality of the relay as playing directly with AC needs to be very careful.

 
   

Controlling DC Devices using Arduino Relay Module
First I will control a led using the relay. Controlling a DC device is easy as compared to the AC device. For controlling the DC device, you do not require an external supply until you are controlling a small voltage device like LED which runs on up to 5V.

 
   

Circuit Diagram and Explanation
The connections for connecting the relay module with Arduino which will connect the relay module with Arduino in the normally open state. So, connect the 5V and the ground of the Arduino with the 5V and the ground of the relay module. Then connect the signal pin of the relay module with the pin 12 of the Arduino.
On the other side of the relay module, we will use the common pin and the normally open pin because we are going to connect the relay in the normally open state. So, connect the pin 13 of Arduino to the common of relay module and the normally open (NO) of the relay module to the positive pin of the LED. Connect the other pin of LED to the ground of Arduino.

 
   
 
   

Description

  • GND pin of 5V Relay – GND pin of Arduino

  • Signal (Input) pin of 5V Relay – pin 7 of Arduino

  • VCC pin of 5V Relay – 5V pin of Arduino

  • Common pin of 5V Relay – pin 12 of Arduino

  • NO pin of 5V Relay – Positive pin of the LED

  • GND pin of LED – GND pin of Arduino

 
   
 

Board Design

 
   
 
   

After that I started drawing the board for milling and soldering the components. The designed circuit for milling of the PCB is as shown below:

 
 
   

After that, I started printing of the board by setting the printer parameters

 
   
 
   

After downloading the .rml file to the local system, now I mounted the milling bit i.e 1/64 for trace and 1/32 for cut. During the installation of the milling bits we have to be careful by holding it in two finger else anything mishap may happen.

 
   

After that, I set to zero for x, y, and z for this Milling which will be a User-Friendly V-Panel. The SRM-20’s VPanel controller provides a simple interface for adjusting tool position and moving the cursor to set the milling starting point. The V-Panel also allows easy control of the feed rate and spindle speed with pause and resume operation, plus tracking of X,Y,Z axis milling with a numeric readout in millimeters or inches.

Select traces png file in the mods after V Panel setting and press calculate in mods, which will give us the .rml file to be send to the Monofab SRM 20 to be milled.

 
 
   
 
   
 
   
 
   
 

 

 

After milling, I carefully de-mounted the printed board from the milling bed and looks like this :

 
 
   

Soldering of Components to the board

 

After successful milling of the board, I mounted the following components;

 

ATTiny 44 - 1 no.

Jumper (3x2) - 2 nos.

Capacitor (22mf) -1 no.

10K Register - 1 no.

 

 

 

 
   

After moutning all the SMD components I tested the circuit so that I can go for testing, but unfortunately, I found some error in the board and its not passing the required power.

I tried to find out the error and found that, there is some itching issue with the board for which the propoer power is not transmitting.

 

Aagain I designed the file and milled another board, so that I can complete the task perfectly.

 
 
 
   
 
   
 
   
 
   
 
   
   
   
   

Code for running the application to see the result that whether working fine or not.

 
 
   
   

For the assignment, I tried to implement the power ON-Off with an IR sensor, which will sense by the motion.

 
   

An infrared proximity sensor or IR Sensor is an electronic device which emits the infrared lights to sense some aspect in the surroundings and can be employed to detect the motion of an object. Since, this is a passive sensor, it can only measure infrared radiation.

 
   

IR Sensor PinOut & descriptions

 
 

VCC  is the power supply pin for the IR sensor which I connected to the 5V pin.
OUT pin is a 5V TTL logic output. LOW indicates no motion is detected; HIGH means motion is detected.
GND Should be connected to the ground of the Arduino.

 
   

How IR Motion Sensor Module Works

 

The working of the IR sensor module is very simple, it consists of two main components: the first is the IR transmitter section and the second is the IR receiver section. In the transmitter section, IR led is used and in the receiver section, a photodiode is used to receive infrared signal and after some signal processing and conditioning, you will get the output.

 
   

An IR proximity sensor works by applying a voltage to the on-board Infrared Light Emitting Diode, which in turn emits infrared light. This light propagates through the air and hits an object, after that the light gets reflected in the photodiode sensor. If the object is close, the reflected light will be stronger, if the object is far away, the reflected light will be weaker. If you look closely toward the module. When the sensor becomes active, it sends a corresponding Low signal through the output pin that can be sensed by an Arduino or any kind of microcontroller to execute a particular task. The one cool thing about this module is that it has two on-board LEDs built-in, one of which lights on when power is available and another one turns on when the circuit gets triggered.

 
   

IR Motion Sensor Module – Parts

 
 

This sensor has three pins two of which are power pins levelled VCC and GND and the other one is the sense/data pin which is shown in the diagram above. It has an on-board power LED and a signal LED the power LED turns on when power is applied to the board the signal LED turns on when the circuit is triggered. This also has a comparator Op-amp that is responsible for converting the incoming analogy signal from the photodiode to a digital signal. We also have a sensitivity adjustment potentiometer; with that, it can adjust the sensitivity of the device. Lastly, we have the photodiode and the IR emitting LED pair, which all together make the total IR Proximity Sensor Module.

 
   

After that, I planned to make the connection for moving towards the final result.

 
 
   
 
   

Video

 



 
           
           

Download Files